<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Proxy-delect</title>
    <script>
        let json = {
            a: 1,
            b: 2
        };

        let newJson = new Proxy(json, {
            deleteProperty(target, property) {
                console.log(`您要删除${property}属性`);
                //TOOO
                delete target[property];
            },
            has(target, property) {
                console.log('判断是否存在调用has方法');
                //TOOO
                return property in target;
            }
        });

        console.log('a' in newJson);

        // delete newJson.a;

        console.log(newJson);
    </script>
</head>

<body>

</body>

</html>